package cn.wolfcode.luowowo.mgrsite.controller;

import cn.wolfcode.luowowo.article.domain.Strategy;
import cn.wolfcode.luowowo.article.domain.StrategyCommend;
import cn.wolfcode.luowowo.article.query.StrategyCommendQuery;
import cn.wolfcode.luowowo.article.query.StrategyQuery;
import cn.wolfcode.luowowo.article.service.IDestinationService;
import cn.wolfcode.luowowo.article.service.IStrategyCommendService;
import cn.wolfcode.luowowo.article.service.IStrategyDetailService;
import cn.wolfcode.luowowo.article.service.IStrategyService;
import cn.wolfcode.luowowo.common.utils.AjaxResult;
import com.alibaba.dubbo.config.annotation.Reference;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("strategyCommend")
public class StrategyCommendController {

    @Reference
    private IStrategyService strategyService;

    @Reference
    private IStrategyDetailService strategyDetailService;
    @Reference
    private IStrategyCommendService strategyCommendService;

    @RequestMapping("/list")
    public String list(Model model, @ModelAttribute("qo")StrategyCommendQuery qo){
        //pageInfo
        model.addAttribute("pageInfo", strategyCommendService.query(qo));
        //details
        model.addAttribute("details", strategyDetailService.list());
        return "strategyCommend/list";
    }

    /*@RequestMapping("/getDestByDeep")
    @ResponseBody
    public Object getDestByDeep(int deep){

        return destinationService.getDestsByDeep(deep);
    }*/

    @RequestMapping("/saveOrUpdate")
    @ResponseBody
    public Object saveOrUpdate(StrategyCommend strategyCommend){
        strategyCommendService.saveOrUpdate(strategyCommend);
        return AjaxResult.SUCCESS;
    }

}
